<?php

/*
 * @author Ebrain Cedeno <ebraincedeno@gmail.com>
 */

abstract class Controller extends Templete{
   
    public function render($class_name,$view){
        
        //cargando el templete
        
        $templete = new Templete();
        $templete->loadThemeContent();
                 
        if (file_exists('view'.DIRECTORY_SEPARATOR.strtolower($class_name).DIRECTORY_SEPARATOR.strtolower($view).".php")){
            
            $ObjectToArray = (array)$this;
            extract($ObjectToArray);
            
            $valor_vista = "include '".'view'.DIRECTORY_SEPARATOR.strtolower($class_name).DIRECTORY_SEPARATOR.strtolower($view).".php';";
            echo self::$headerTheme;
            echo eval($valor_vista);
            echo self::$footerTheme;
            
        }
        else{
            throw new Exception("No se encontro la vista solicitada");
        }
    }
    
    public function redirec($url,$time=0,$param=array(),$optionsHtml=array()){
        header("refresh:".$time.";url=".$url);
    }
    
}
?>
